from numpy import polyfit


def polynom(f, x, y, degree):
    app = list(reversed(polyfit(x, y, degree, rcond=None)))

    funcx = 0
    for i in range(degree + 1):
        funcx += app[i] * (f ** i)

    return funcx
